/////////////////////////////////////////////////////////////////////////////
// Name:        commandeditordialog.h
// Purpose:     
// Author:      Julian Smart
// Modified by: 
// Created:     22/11/2008 13:43:50
// RCS-ID:      
// Copyright:   (c) Anthemion Software Limited
// Licence:     New BSD License
/////////////////////////////////////////////////////////////////////////////

#ifndef _COMMANDEDITORDIALOG_H_
#define _COMMANDEDITORDIALOG_H_


/*!
 * Includes
 */

////@begin includes
////@end includes

#include "uiutils/scrollingdialog.h"
#include "commandeditor/commandeditor.h"

class wxUICustomization;

/*!
 * Forward declarations
 */

////@begin forward declarations
////@end forward declarations

/*!
 * Control identifiers
 */

////@begin control identifiers
#define ID_COMMANDEDITORDIALOG 21500
#define ID_COMMANDEDITORDIALOG_COMMANDS 21501
#define ID_COMMANDEDITORDIALOG_ADD 21502
#define ID_COMMANDEDITORDIALOG_DELETE 21503
#define ID_COMMANDEDITORDIALOG_RENAME 21504
#define ID_COMMANDEDITORDIALOG_NAME 21505
#define ID_COMMANDEDITORDIALOG_COMMAND 21506
#define ID_COMMANDEDITORDIALOG_BROWSE 21507
#define ID_COMMANDEDITORDIALOG_SHOWTHIS 21508
#define SYMBOL_WXCOMMANDEDITORDIALOG_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL
#define SYMBOL_WXCOMMANDEDITORDIALOG_TITLE _("Command Editor")
#define SYMBOL_WXCOMMANDEDITORDIALOG_IDNAME ID_COMMANDEDITORDIALOG
#define SYMBOL_WXCOMMANDEDITORDIALOG_SIZE wxSize(400, 300)
#define SYMBOL_WXCOMMANDEDITORDIALOG_POSITION wxDefaultPosition
////@end control identifiers


/*!
 * wxCommandEditorDialog class declaration
 */

class wxCommandEditorDialog: public wxScrollingDialog
{    
    DECLARE_DYNAMIC_CLASS( wxCommandEditorDialog )
    DECLARE_EVENT_TABLE()

public:
    /// Constructors
    wxCommandEditorDialog();
    wxCommandEditorDialog( const wxEditorCommandArray& cmds, const wxString& msg, wxWindow* parent, wxWindowID id = SYMBOL_WXCOMMANDEDITORDIALOG_IDNAME, const wxString& caption = SYMBOL_WXCOMMANDEDITORDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXCOMMANDEDITORDIALOG_POSITION, const wxSize& size = SYMBOL_WXCOMMANDEDITORDIALOG_SIZE, long style = SYMBOL_WXCOMMANDEDITORDIALOG_STYLE );

    /// Creation
    bool Create( const wxEditorCommandArray& cmds, const wxString& msg, wxWindow* parent, wxWindowID id = SYMBOL_WXCOMMANDEDITORDIALOG_IDNAME, const wxString& caption = SYMBOL_WXCOMMANDEDITORDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXCOMMANDEDITORDIALOG_POSITION, const wxSize& size = SYMBOL_WXCOMMANDEDITORDIALOG_SIZE, long style = SYMBOL_WXCOMMANDEDITORDIALOG_STYLE );

    /// Destructor
    ~wxCommandEditorDialog();

    /// Initialises member variables
    void Init();

    /// Creates the controls and sizers
    void CreateControls();
    
    const wxEditorCommandArray& GetCommands() const { return m_commands; }
    wxEditorCommandArray& GetCommands() { return m_commands; }

    const wxEditorCommand& GetCommand(int i) const { return m_commands[i]; }
    
    /// Populate command list
    void PopulateCommands();
    
    /// Show command
    void ShowCommand(int i);

    /// Use tooltips
    static void SetUseTooltips(bool useTooltips) { sm_useTooltips = useTooltips; }

    /// Set help id
    static void SetHelpId(int helpId) { sm_helpId = helpId; }

    ///  Set UI customization
    static void SetUICustomization(wxUICustomization* uiCustomization) { sm_uiCustomization = uiCustomization; }

////@begin wxCommandEditorDialog event handler declarations

    /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_COMMANDEDITORDIALOG_COMMANDS
    void OnCommandeditordialogCommandsSelected( wxCommandEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_COMMANDEDITORDIALOG_ADD
    void OnCommandeditordialogAddClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_COMMANDEDITORDIALOG_DELETE
    void OnCommandeditordialogDeleteClick( wxCommandEvent& event );

    /// wxEVT_UPDATE_UI event handler for ID_COMMANDEDITORDIALOG_DELETE
    void OnCommandeditordialogDeleteUpdate( wxUpdateUIEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_COMMANDEDITORDIALOG_RENAME
    void OnCommandeditordialogRenameClick( wxCommandEvent& event );

    /// wxEVT_UPDATE_UI event handler for ID_COMMANDEDITORDIALOG_RENAME
    void OnCommandeditordialogRenameUpdate( wxUpdateUIEvent& event );

    /// wxEVT_UPDATE_UI event handler for ID_COMMANDEDITORDIALOG_NAME
    void OnCommandeditordialogNameUpdate( wxUpdateUIEvent& event );

    /// wxEVT_UPDATE_UI event handler for ID_COMMANDEDITORDIALOG_COMMAND
    void OnCommandeditordialogCommandUpdate( wxUpdateUIEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_COMMANDEDITORDIALOG_BROWSE
    void OnCommandeditordialogBrowseClick( wxCommandEvent& event );

    /// wxEVT_UPDATE_UI event handler for ID_COMMANDEDITORDIALOG_BROWSE
    void OnCommandeditordialogBrowseUpdate( wxUpdateUIEvent& event );

    /// wxEVT_UPDATE_UI event handler for ID_COMMANDEDITORDIALOG_SHOWTHIS
    void OnCommandeditordialogShowthisUpdate( wxUpdateUIEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_HELP
    void OnHelpClick( wxCommandEvent& event );

    /// wxEVT_UPDATE_UI event handler for wxID_HELP
    void OnHelpUpdate( wxUpdateUIEvent& event );

////@end wxCommandEditorDialog event handler declarations

////@begin wxCommandEditorDialog member function declarations

    /// Retrieves bitmap resources
    wxBitmap GetBitmapResource( const wxString& name );

    /// Retrieves icon resources
    wxIcon GetIconResource( const wxString& name );
////@end wxCommandEditorDialog member function declarations

    /// Should we show tooltips?
    static bool ShowToolTips();

////@begin wxCommandEditorDialog member variables
    wxStaticText* m_captionCtrl;
    wxListBox* m_commandsCtrl;
    wxTextCtrl* m_nameCtrl;
    wxTextCtrl* m_commandCtrl;
    wxCheckBox* m_showThisCommandCtrl;
////@end wxCommandEditorDialog member variables

    wxEditorCommandArray        m_commands;
    wxString                    m_caption;
    static int                  sm_helpId;
    static bool                 sm_useTooltips;
    static wxUICustomization*   sm_uiCustomization;
};

#endif
    // _COMMANDEDITORDIALOG_H_
